<?php
include '../include/functions.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//Dtd html 4.01 Transitional//EN"
"http://www.w3.org/tr/html4/loose.dtd">
<html>
  <head>
    <title>JoshHughes.com NHL Hockey Pool</title>
	<link rel="shortcut icon" href="http://hockey.joshhughes.com/NHL/images/nhlFavicon.gif" />
	<link rel="stylesheet" href="http://hockey.joshhughes.com/css/NHL.css" type="text/css">
    <script src="http://hockey.joshhughes.com/scripts/prototype.js" type="text/javascript"></script>
	<script src="http://hockey.joshhughes.com/scripts/scriptaculous.js" type="text/javascript"></script>
	<script src="http://hockey.joshhughes.com/scripts/hockey.js" type="text/javascript"></script>
  </head>
<body>
<div id="pagewidth" >
	<div id="header" >	
		<?PHP include_once("layout/header.html"); ?>		
	</div>
	
	<div id="wrapper" class="clearfix" > 
		<div id="maincol" >
		<p>* Team Information will only include games played in the playoffs.  No regular season data will be added to this page. *</p>
		<!-- InstanceBeginEditable name="Contents" -->		
			<?
			//Connect To Database
			dbConnect();

			$Conference = array("Eastern", "Western");
			
			foreach ($Conference as $confkey)
				{
				?>
				<table width="700" cellpadding="5" cellspacing="0">		
					<tr>
						<td align="center" class="
					<?
						if ($confkey == "Eastern") {
							echo "redbg";
							$Division = array("Atlantic", "Northeast", "Southeast");
						} else {
							echo "bluebg";
							$Division = array("Pacific", "Northwest", "Central");
						}
					?>" height="1">
							<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
					<?
					foreach ($Division as $divkey)
					{
						echo "
								<tr>
									<th width=\"100%\" colspan=\"11\" align=\"Left\"><span class=\"whitelink\">".$confkey." ".$divkey." Division</span></th>
								</tr>\n";
						?>
								<tr bgcolor="#FFFFFF">
									<th width="45">&nbsp;</th>
									<th width="200" align="left">Team</th>
									<th width="90" align="left">W-L-T</th>
									<th width="40" align="left">PF</th>
									<th width="40" align="left">PA</th>
									<th width="50" align="left">Home</th>
									<th width="50" align="left">Road</th>
									<th width="50" align="left">East</th>
									<th width="50" align="left">West</th>
									<th width="50" align="left">DIV</th>
									<th width="40" align="left">Streak</th>
								</tr>    
						<?
						//Write SQL Query to extract specified data
						$SQL = "SELECT * FROM NHLTeams WHERE ((Conference = '".$confkey."') AND (Division = '".$divkey."')) ORDER BY Wins DESC, Loses ASC";
						//Open Record Set using SQL Query
						$result = mysql_query($SQL) or die("Cannot query the database.<br/>");
						$row = 0;
						do{
							if (($myrow["TeamName"] != Null) || ($myrow["TeamName"] != "")) {
								$row++;
							echo "
								<tr  bgcolor=\"".getrowColor($row)."\">
									<td align=\"left\"><img src=\"images/small/".$myrow["TeamName"].".gif\" alt=\"".$myrow["City"]." ".$myrow["TeamName"]."\" title=\"".$myrow["City"]." ".$myrow["TeamName"]."\" border=\"0\"></td>
									<td align=\"left\"><B><a href=\"".$myrow["URL"]."\" class=\"permLink\" target=\"blank\" title=\"See more of the ".$myrow["City"]." ".$myrow["TeamName"]." @ ".$myrow["URL"]."\">".$myrow["City"]." ".$myrow["TeamName"]."</a></B></td>
									<td align=\"left\">".$myrow["Wins"]." - ".$myrow["Loses"]." - ".$myrow["Ties"]."</td>
									<td align=\"left\">".$myrow["PointsFor"]."</td>
									<td align=\"left\">".$myrow["PointsAgainst"]."</td>
									<td align=\"left\">".$myrow["HomeWins"]." - ".$myrow["HomeLosses"]."</td>
									<td align=\"left\">".$myrow["RoadWins"]." - ".$myrow["RoadLosses"]."</td>
									<td align=\"left\">".$myrow["EastWins"]." - ".$myrow["EastLosses"]."</td>
									<td align=\"left\">".$myrow["WestWins"]." - ".$myrow["WestLosses"]."</td>
									<td align=\"left\">".$myrow["DivWins"]." - ".$myrow["DivLosses"]."</td>
									<td align=\"left\"> ".$myrow["Streak"]."</td>
								</tr>";
							}
						}while($myrow = mysql_fetch_array($result));
					}//end foreach loop
				?>
								</table>
							</td>
						</tr>
					</table>
				<BR>
				<?
			} //end FOR EACH ($Conference) LOOP ?>
		
		<!-- InstanceEndEditable -->
		
		</div> <!-- Close maincol div   -->
		
		<div id="leftcol" >		
			<?PHP include_once("layout/left_column.php"); ?>		
		</div>
		
			
	</div> <!-- Close wrapper div   -->

	<div id="footer" >	
		<?PHP include_once("layout/footer.html"); ?>	
	</div>

		
</div>
</body>
</html>